# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Kyle Keen <keenerd@gmail.com>

_pyname=traitlets
pkgname=python-$_pyname
pkgver=5.13.0
pkgrel=1
pkgdesc='A configuration system for Python applications'
arch=(any)
url='https://traitlets.readthedocs.io/en/stable'
license=(BSD)
depends=(python
         python-argcomplete
         python-typing_extensions)
makedepends=(python-build
             python-hatchling
             python-installer)
checkdepends=(python-pytest-mock
              python-pytest-mypy-testing)
source=(https://pypi.python.org/packages/source/t/traitlets/traitlets-$pkgver.tar.gz)
sha256sums=('9b232b9430c8f57288c1024b34a8f0251ddcc47268927367a0dd3eeaca40deb5')

build() {
  cd $_pyname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_pyname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v -k 'not mypy_dict_typing'
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
